#ifndef TILETYPE_H
#define TILETYPE_H

#include <qstring.h>
#include <qbitarray.h>

#include "unittype.h"

struct TileTypeProperties {
public:
    TileTypeProperties();
    void fillPracticability(quint8 n);  //sets the practicability for every unitType to n

    QString name;
    quint8 practicability[unitTypeNumber];
    quint8 protection;
    quint8 slow;
};

enum TileType {HOLE, WALL, PLAIN, WATER, MOUNTAIN, SAND, FOREST, SWAMP};
const quint8 tileTypeNumber = 8;

class TileTypeFactory {
    //Singleton that manages the tile types
public:
    static TileTypeFactory& getInstance();
    TileTypeProperties getTileProperties(TileType) const;

    //Returns the practicability of a tile of tileType by an unit of unitType
    quint8 getPracticability(TileType tileType, UnitType unitType) const;

private:
    //The TileTypeFactory must be created using getInstance() as it's a singleton
    TileTypeFactory();
    TileTypeFactory(const TileTypeFactory&);
    TileTypeFactory& operator=(const TileTypeFactory&);

    quint8 m_typesNb;
    TileTypeProperties m_types[8];
};

#endif // TILETYPE_H
